var url = serverPre + "/api/v0/quartz/"+systemName+"/task";

var bsConf = {

    queryFormId: "schedule-query-form",

    createFormId: "schedule-create-form",

    updateFormId: "schedule-update-form",

    tableID: "id",

    queryCols: 3,

    queryFloat: "right",

    voName: "scheduleInfo",

    queryConfigs:                   //页面头部查询form
        [
            {
                type: 'text',
                label: '任务名称',
                name: 'jobName',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '任务组',
                name: 'jobGroup',
                default: '',
                verify: ''
            }
        ],

    createConfigs:
        [
            {
                type: 'text',
                label: '任务名称',
                name: 'jobName',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '任务组',
                name: 'jobGroup',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '类路径',
                name: 'className',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '参数',
                name: 'paras',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '执行周期',
                name: 'cronConf',
                default: '',
                verify: ''
            }
        ],

    updateConfigs:
        [
            {
                type: 'text',
                label: '任务名称',
                name: 'jobName',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '任务组',
                name: 'jobGroup',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '类路径',
                name: 'className',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '参数',
                name: 'paras',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                label: '执行周期',
                name: 'cronConf',
                default: '',
                verify: ''
            }
        ],

    //列表内容
    tableCols: [
        {field: 'id', title: '序号', type: 'numbers'}
        , {field: 'jobName', width: 185, title: '任务名称', align: 'center'}
        , {field: 'jobGroup', width: 100, title: '任务组', align: 'center'}
        , {field: 'className', title: '类路径', align: 'center'}
        , {field: 'paras', width: 200, title: '参数', align: 'center'}
        , {field: 'cronConf', width: 155, title: '执行周期', align: 'center'}
        , {field: 'statusStr', width: 100, title: '状态', align: 'center'}
        , {fixed: 'right', width: 300, title: '操作',align: 'center', toolbar: '#barDemo'}
    ],
    
    pauseTask:function (id) {
        operateTask(id,"pause");
    },
    
    resumeTask:function (id) {
        operateTask(id,"resume");
    },

    runTask:function(id){
        operateTask(id,"run");
    }
};


var operateTask = function(id,operation){
    $.ajax({
        type: 'post',
        headers: {"token": getCookie("token")},
        url: url+"/"+operation+"/"+id,
        async: false,
        cache: false,
        success: function (result) {
            if (result.code == 0) {
                queryData(url, 1, 20);
            }else{

            }
        }
    });
};
